//
//  BookPlaceDetailPhotosCell.m
//  FreeTrip
//
//  Created by 352324497@qq.com on 15/11/26.
//  Copyright © 2015年 邓芮. All rights reserved.
//

#import "BookPlaceDetailPhotosCell.h"

@implementation BookPlaceDetailPhotosCell

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        self.photoImageView = [[UIImageView alloc]init];
//        self.photoImageView.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_photoImageView];
    }
    return self;
}


-(void)setModel:(PhotosModel *)model
{
    _model = model;
    [self.photoImageView sd_setImageWithURL:[NSURL URLWithString:model.image_url] placeholderImage:[UIImage imageNamed:@"placeholder"]];

    CGFloat width = model.image_width * 120 * KScreenWidth / 375 / model.image_height;
    self.photoImageView.frame = CGRectMake(0, 0, width, 120 * KScreenWidth / 375);
}

+(CGFloat)heightForCell:(PhotosModel *)model
{
    CGFloat height =model.image_width * 120 * KScreenWidth / 375 / model.image_height;
    return height;
}
@end
